/**
 * 
 */
package br.com.salaodebeleza.util;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import br.com.salaodebeleza.domain.TbAgenda;


/**
 * @author tiagofranca
 *
 */
public class TbAgendaDataModel extends ListDataModel<TbAgenda> implements SelectableDataModel<TbAgenda> {
	
	public TbAgendaDataModel() {}
	
	public TbAgendaDataModel(List<TbAgenda> list) {
		super(list);
	}

	@Override
	public TbAgenda getRowData(String rowKey) {
		List<TbAgenda> list = (List<TbAgenda>) getWrappedData();
		
		for (TbAgenda p : list) {
			if (String.valueOf(p.getId()).equals(rowKey)) {
				return p;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(TbAgenda agenda) {
		return String.valueOf(agenda.getId());
	}

}
